---------------------------------------------------------------------------------------------------------------------
      name:  <unnamed>
       log:  c:\data\Expect\WE\tableres4.log
  log type:  text
 opened on:  25 Apr 2016, 13:37:33

. 
. #delimit;
delimiter now ;
. u WE_Data1;

. replace mu_R=mu_R-1;
(1734 real changes made)

.                         /*Net returns because the instruments are net returns*/
> replace mu_rbnd=mu_rbnd-1;
(1225 real changes made)

. replace mu_rf=mu_rf-1;
(1225 real changes made)

. /*Drop ouliers (1%)*/
> replace mu_R=. if mu_R<=-0.75 /*| mu_R>.15*/;
(31 real changes made, 31 to missing)

. replace mu_rf=. if mu_rf<=-0.04 /*| mu_rf>=0.044*/;
(23 real changes made, 23 to missing)

. replace mu_rbnd=. if mu_rbnd<=0 | mu_rbnd>=0.10;
(21 real changes made, 21 to missing)

. gen Dexp1=mu_R!=.;

.  replace Dexp1=. if anno==2010;
(7951 real changes made, 7951 to missing)

. gen Dexp2=mu_rf!=.;

.  replace Dexp2=. if anno==2010;
(7951 real changes made, 7951 to missing)

. /********** COMPUTE REALIZATIONS: R10(1+R09)+R9 **********/
> 
> gen RR  = FTSE2010/100   *(1+FTSE2009/100)   +FTSE2009/100;
(7951 missing values generated)

. gen Rbnd= gbnds2010/100  *(1+gbnds2009/100)  +gbnds2009/100;
(7951 missing values generated)

. gen Rrf = bankdep2010/100*(1+bankdep2009/100)+bankdep2009/100;
(7951 missing values generated)

. /*For realized housing returns, I take 2010 SHIW prov/com avg changes in valabit/supab (over previous 2 yrs)*/
> ren rH_prov rH_prov2;

.  lab var rH_prov2 "Avg biennial (2009, 2010) return on housing, by iprov";

. gen rH_prov=sqrt(rH_prov2+1)-1;
(7951 missing values generated)

. /******NOTA BENE che il rendimento e' il rendimento medio sul biennio/anno precedente!!!*/ 
> 
> gen RH = rH_prov*(1+rH_prov)+rH_prov;
(7951 missing values generated)

. /**********************************************************/
> 
> keep nq anno cn /*
> */ mu_H sex yrsedu whiteco eta A52-A55 com2-com4 Dnperc lit risfin risf2 Daf3 /*
> */ p_prov p_prov2 p_com2-p_com4 p_A5* impacq* manstra anposs anposq Danposs piubagni /*
> */ hprices06 hpr_sq sport04 high_grw trib_inef va2 avgva rotaz x_cas /*
> */ lowcomp verored klima Dexp* /*
> */ mu_R FTSEm_l1-FTSEm_l6 x_bor FTSEmo* /*
> */ mu_rf bank_l1-bank_l6 x_int bankdep* /*
> */ mu_rbnd bonds_l1-bonds_l6 bonds* /*
> */ af af1-af3 ar ar1-ar3 R* sig*/*
> */ ncomp nperc np2 married employed pubblico self small Dpf;

. sort nq anno;

.  save databoot,replace;
file databoot.dta saved

. /****/
> 
> #delimit cr
delimiter now cr
. 
. capture program drop weeffect

.     program define weeffect
  1.             version 7.0
  2. 
.                         /******FIT H*****/
.                         heckman mu_H sex yrsedu whiteco eta A52-A55 com2-com4 Dnperc lit risfin risf2 Daf3 /*
>                         */ p_prov p_prov2 p_com2-p_com4 p_A5* impacq* manstra anposs anposq Danposs piubagni /*
>                         */ hprices06 hpr_sq sport04 high_grw trib_inef va2 avgva if rotaz==1 & x_cas==0, /*
>                         */ select(lowcomp verored klima Dexp sex sex yrsedu whiteco eta A52-A55 com2-com4 Dnperc li
> t risfin risf2 Daf3 /*
>                         */ p_prov p_prov2 p_com2-p_com4 p_A5* impacq* manstra anposs anposq Danposs piubagni /*
>                         */ hprices06 hpr_sq sport04 high_grw trib_inef va2 avgva) nolog twostep 
  3. 
.                         predict mu_Hh_heck                      /*Valabit is missing for a handful of households*/
  4.                                                                                 /*1ST FITTED REGRESSOR*/
. 
.                         sort nq anno
  5.                         qui by nq: gen mu_H10=mu_H[_n+1]
  6.                         lab var mu_H10 "Expected return on housing in 2010 (for those in the panel)"
  7.                                 
.                         /******FIT FTSE*****/
.                         gen x1=FTSEm_l1
  8.                         gen x2=FTSEm_l2
  9.                         gen x3=FTSEm_l3
 10.                         gen x4=FTSEm_l4
 11.                         gen x5=FTSEm_l5
 12.                         gen x6=FTSEm_l6
 13. 
.                         qui heckman mu_R sex yrsedu whiteco eta A52-A55 com2-com4 Dnperc lit risfin risf2 Daf3 /*
>                         */ FTSEm_l1 FTSEm_l2 FTSEm_l3 FTSEm_l4 FTSEm_l5 FTSEm_l6 hprices06 hpr_ sport04 /*
>                         */ trib_inef high_grw va2 avgva if x_bor==0, /*
>                         */ select(lowcomp verored klima Dexp2 sex yrsedu whiteco eta A52-A55 com2-com4 lit Dnperc r
> isfin risf2/*
>                         */ Daf3 FTSEm_l1 FTSEm_l2 FTSEm_l3 FTSEm_l4 FTSEm_l5 FTSEm_l6 hprices06 hpr_ sport04 /*
>                         */ trib_inef high_grw va2 avgva) nolog twostep
 14. 
.                         replace FTSEm_l1=FTSEmo12
 15.                         replace FTSEm_l2=FTSEmo11
 16.                         replace FTSEm_l3=FTSEmo10 
 17.                         replace FTSEm_l4=FTSEmo9
 18.                         replace FTSEm_l5=FTSEmo8
 19.                         replace FTSEm_l6=FTSEmo7
 20.                         predict mu_Rh_heck if x_bor==0  /*2ND FITTED REGRESSOR*/
 21. 
.                         replace FTSEm_l1=x1
 22.                         replace FTSEm_l2=x2
 23.                         replace FTSEm_l3=x3 
 24.                         replace FTSEm_l4=x4
 25.                         replace FTSEm_l5=x5
 26.                         replace FTSEm_l6=x6
 27.                         drop x1-x6
 28. 
.                         /******FIT Bank deposits*****/
.                         gen x1=bank_l1
 29.                         gen x2=bank_l2
 30.                         gen x3=bank_l3
 31.                         gen x4=bank_l4
 32.                         gen x5=bank_l5
 33.                         gen x6=bank_l6
 34. 
.                         qui heckman mu_rf sex yrsedu whiteco eta A52-A55 com2-com4 Dnperc lit risfin risf2 Daf3 /*
>                         */ bank_l1 bank_l2 bank_l3 bank_l4 bank_l5 bank_l6 hprices06 hpr_ sport04 /*
>                         */ trib_inef high_grw va2 avgva if x_int==0, /*
>                         */ select(lowcomp verored klima Dexp1 sex yrsedu whiteco eta A52-A55 com2-com4 Dnperc lit r
> isfin risf2/*
>                         */ Daf3 bank_l1 bank_l2 bank_l3 bank_l4 bank_l5 bank_l6 hprices06 hpr_ sport04 /*
>                         */ trib_inef high_grw va2 avgva) nolog twostep
 35. 
.                         replace bank_l1=bankdep12
 36.                         replace bank_l2=bankdep11
 37.                         replace bank_l3=bankdep10 
 38.                         replace bank_l4=bankdep9
 39.                         replace bank_l5=bankdep8
 40.                         replace bank_l6=bankdep7
 41.                         predict mu_rfh_heck if x_int==0         /*3RD FITTED REGRESSOR*/
 42. 
.                         replace bank_l1=x1
 43.                         replace bank_l2=x2
 44.                         replace bank_l3=x3 
 45.                         replace bank_l4=x4
 46.                         replace bank_l5=x5
 47.                         replace bank_l6=x6
 48.                         drop x1-x6
 49.                         
.                         /******FIT Government bonds*****/
.                         gen x1=bonds_l1
 50.                         gen x2=bonds_l2
 51.                         gen x3=bonds_l3
 52.                         gen x4=bonds_l4
 53.                         gen x5=bonds_l5
 54.                         gen x6=bonds_l6
 55. 
.                         qui heckman mu_rbnd sex yrsedu whiteco eta A52-A55 com2-com4 Dnperc lit risfin risf2 Daf3 /
> *
>                         */ bonds_l1 bonds_l2 bonds_l3 bonds_l4 bonds_l5 bonds_l6 hprices06 hpr_ sport04 /*
>                         */ trib_inef high_grw va2 avgva if x_int==0, /*
>                         */ select(lowcomp verored klima Dexp1 sex yrsedu whiteco eta A52-A55 com2-com4 Dnperc lit r
> isfin risf2/*
>                         */ Daf3 bonds_l1 bonds_l2 bonds_l3 bonds_l4 bonds_l5 bonds_l6 hprices06 hpr_ sport04 /*
>                         */ trib_inef high_grw va2 avgva) nolog twostep
 56. 
.                         replace bonds_l1=bonds12
 57.                         replace bonds_l2=bonds11
 58.                         replace bonds_l3=bonds10 
 59.                         replace bonds_l4=bonds9
 60.                         replace bonds_l5=bonds8
 61.                         replace bonds_l6=bonds7
 62.                         predict mu_rbndh_heck if x_int==0       /*4TH FITTED REGRESSOR*/
 63. 
.                         replace bonds_l1=x1
 64.                         replace bonds_l2=x2
 65.                         replace bonds_l3=x3 
 66.                         replace bonds_l4=x4
 67.                         replace bonds_l5=x5
 68.                         replace bonds_l6=x6
 69.                         drop x1-x6
 70.                         
.                         /**************************************************************************************/
. 
.                         /********** COMPUTE (1+rho)E08(R09) (expectation)**********/
.                         #delimit;
delimiter now ;
.                         gen exp_R  =(1+0.4558194)*mu_R;
 71.                         gen exp_Rhk=(1+0.4558194)*mu_Rh_heck;
 72.                         gen exp_bnd  =(1+0.7531304)*mu_rbnd;
 73.                         gen exp_bndhk=(1+0.7531304)*mu_rbndh_heck;
 74.                         gen exp_rf  =(1+0.739289)*mu_rf;
 75.                         gen exp_rfhk=(1+0.739289)*mu_rfh_heck;
 76.                         gen exp_Hhk=2*mu_Hh_heck;
 77.                         /********NOW CONSTRUCT the regressors**********************/
>                         /*... unexpected shocks...*/
>                         gen unexp_af1  =af1*(Rrf-exp_rf);
 78.                         gen unexp_af1hk=af1*(Rrf-exp_rfhk);
 79.                         gen unexp_af2  =af2*(Rbnd-exp_bnd);
 80.                 /*Many zeros for non-holders!*/
>                         gen unexp_af2hk=af2*(Rbnd-exp_bndhk);
 81.                         gen unexp_af3  =af3*(RR-exp_R);
 82.                         gen unexp_af3hk=af3*(RR-exp_Rhk);
 83.                         gen unexp_ar1hk=ar1*(RH-exp_Hhk);
 84.                         gen unexp_ar2  =ar2*(RR-exp_R);
 85.                         gen unexp_ar2hk=ar2*(RR-exp_Rhk);
 86.                         gen unexp_af  =unexp_af1+unexp_af2+unexp_af3;
 87.                         gen unexp_ar  =unexp_ar1hk+unexp_ar2;
 88.                         gen unexp_afar=unexp_af+unexp_ar;
 89.                         gen unexp_afhk=unexp_af1hk+unexp_af2hk+unexp_af3hk;
 90.                         gen unexp_arhk=unexp_ar1hk+unexp_ar2hk;
 91.                         gen unexp_afarhk=unexp_afhk+unexp_arhk;
 92.                         gen unexp_af12  = unexp_af1  +unexp_af2;
 93.                         gen unexp_af12hk= unexp_af1hk+unexp_af2hk;
 94.                         gen unexp_af3ar2  = unexp_af3  +unexp_ar2;
 95.                         gen unexp_af3ar2hk= unexp_af3hk+unexp_ar2hk;
 96.                         /* ... and anticipated changes */
>                         gen exp_af1  =af1*exp_rf;
 97.                         gen exp_af1hk=af1*exp_rfhk;
 98.                         gen exp_af2  =af2*exp_bnd;
 99.                         gen exp_af2hk=af2*exp_bndhk;
100.                         gen exp_af3  =af3*exp_R;
101.                         gen exp_af3hk=af3*exp_Rhk;
102.                         gen exp_ar1hk=ar1*exp_Hhk;
103.                         gen exp_ar2  =ar2*exp_R;
104.                         gen exp_ar2hk=ar2*exp_Rhk;
105.                         gen exp_af  =exp_af1+exp_af2+exp_af3;
106.                         gen exp_ar  =exp_ar1hk+exp_ar2;
107.                         gen exp_afar=exp_af+exp_ar;
108.                         gen exp_afhk=exp_af1hk+exp_af2hk+exp_af3hk;
109.                         gen exp_arhk=exp_ar1hk+exp_ar2hk;
110.                         gen exp_afarhk=exp_afhk+exp_arhk;
111.                         gen exp_af12 =exp_af1 +exp_af2;
112.                         gen exp_af12hk=exp_af1hk+exp_af2hk;
113.                         gen exp_af3ar2  = exp_af3  +exp_ar2;
114.                         gen exp_af3ar2hk= exp_af3hk+exp_ar2hk;
115.                         gen afar=af+ar;
116.                                                 /*2008-2010 panel*/
>                         drop if (eta<20 | eta>80) & anno==2008;
117.                         sort nq anno;
118.  qui by nq: gen N=_N;
119.  keep if N==2;
120.  drop N;
121.                         sort nq anno;
122.                         qui by nq: gen delta_cn=(cn[_n+1]-cn)/1000;
123.                         qui by nq: gen cngrw =(cn[_n+1]-cn)/cn;
124.                         drop if cngrw<-0.5 | (cngrw>2 & cngrw!=.);
125.  drop cngrw;
126.                                                 sort nq anno;
127.  qui by nq: gen N=_N;
128.  keep if N==2;
129.  drop N;
130. /*NEW TABLE 4*/
>                         
>                         /************************************************************************/
>                         /****                    WEALTH REGRESSIONS (TABLE 4)                ****/
>                         /************************************************************************/
>                         #delimit cr
delimiter now cr
. 
.                         /*REGRESSIONS WITH EXPECTATIONS (Sample of respondents)*/
.                         /*ONE: af+ar*/
.                         reg delta_cn unexp_afar exp_afar eta yrsedu* sex ncomp nperc np2 married employed pubblico 
> self A52-A55 small Dpf /*
>                         */ if afar>0 & mu_R!=. & mu_rf!=. & afar<2000, r
131.         
.                         gen respondent=e(sample)
132.                         replace respondent=. if anno==2010
133.                                 
.                         /*Now, I must save the coefficients*/
.                         scalar def reg1=_b[unexp_afar]
134.                         scalar def reg2=_b[exp_afar] 
135.                                         
. 
.                         /*TWO: af, ar*/
.                         reg delta_cn unexp_af unexp_ar exp_af exp_ar eta yrsedu* sex ncomp nperc np2 married employ
> ed pubblico self A52-A55 small Dpf /*
>                         */ if afar>0 & mu_R!=. & mu_rf!=. & afar<2000, r
136.                         scalar def reg3=_b[unexp_af]
137.                         scalar def reg4=_b[unexp_ar]
138.                         scalar def reg5=_b[exp_af]
139.                         scalar def reg6=_b[exp_ar]
140.                         
.                         
. /*NEW*/         /*THREE: af+ar, selection*/
.                         heckman delta_cn unexp_afar exp_afar eta yrsedu* sex ncomp nperc np2 married employed pubbl
> ico self A52-A55 small Dpf, ///
>                         select(respondent=/*unexp_afar exp_afar*/ eta yrsedu* sex ncomp nperc np2 married employed 
> pubblico self A52-A55 small Dpf ///
>                         lowcomp verored klima) two
141.                         scalar def reg7=_b[unexp_afar]
142.                         scalar def reg8=_b[exp_afar]
143. 
.                         
. /*NEW*/         /*FOUR: af, ar, selection*/
.                         heckman delta_cn unexp_af unexp_ar exp_af exp_ar eta yrsedu* sex ncomp nperc np2 married em
> ployed pubblico self A52-A55 small Dpf, ///
>                         select(respondent= eta yrsedu* sex ncomp nperc np2 married employed pubblico self A52-A55 s
> mall Dpf ///
>                         lowcomp verored klima) two
144.                         scalar def reg9 =_b[unexp_af]
145.                         scalar def reg10=_b[unexp_ar]
146.                         scalar def reg11=_b[exp_af]
147.                         scalar def reg12=_b[exp_ar]
148. 
. 
.                         /*REGRESSIONS WITH PREDICTIONS*/
.                         /*Sample of respondents*/
.                         /*FIVE: af+ar*/
.                         reg delta_cn unexp_afarhk exp_afarhk eta yrsedu* sex ncomp nperc np2 married employed pubbl
> ico self A52-A55 small Dpf /*
>                         */ if afar>0 & mu_R!=. & mu_rf!=. & afar<2000, r
149.                         scalar def reg13=_b[unexp_afarhk]
150.                         scalar def reg14=_b[exp_afarhk] 
151.                         
.                         
.                         /*SIX: af, ar*/
.                         reg delta_cn unexp_afhk unexp_arhk exp_afhk exp_arhk eta yrsedu* sex ncomp nperc np2 marrie
> d employed pubblico self A52-A55 small Dpf /*
>                         */ if afar>0 & mu_R!=. & mu_rf!=. & afar<2000, r
152.                         *outreg unexp_af exp_af unexp_arhk exp_arhk using table4, se 3aster append
.                         scalar def reg15=_b[unexp_afhk]
153.                         scalar def reg16=_b[unexp_arhk]
154.                         scalar def reg17=_b[exp_afhk]
155.                         scalar def reg18=_b[exp_arhk]
156.                                                         
.                         /*Whole sample*/
.                         /*SEVEN: af+ar*/
.                         reg delta_cn unexp_afarhk exp_afarhk eta yrsedu* sex ncomp nperc np2 married employed pubbl
> ico self A52-A55 small Dpf /*
>                         */ if afar>0 & ar<1000 & af3<100, r
157.                         scalar def reg19=_b[unexp_afarhk]
158.                         scalar def reg20=_b[exp_afarhk] 
159.                         
.                         
.                         /*EIGHT: af, ar*/
.                         reg delta_cn unexp_afhk unexp_arhk exp_afhk exp_arhk eta yrsedu* sex ncomp nperc np2 marrie
> d employed pubblico self A52-A55 small Dpf /*
>                         */ if afar>0 & ar<1000 & af3<100, r
160.                         scalar def reg21=_b[unexp_afhk]
161.                         scalar def reg22=_b[unexp_arhk]
162.                         scalar def reg23=_b[exp_afhk]
163.                         scalar def reg24=_b[exp_arhk]
164.                 
. end

. 
. 
. set seed 171202

.         u databoot,clear

.         bsample

.         *bsample, cluster(nquest) id(id) strata(panel)          /*HERE... WHAT?*/
. 
.         /*qui*/ weeffect                /*Run the estimation program*/
note: sex dropped because of collinearity

Heckman selection model -- two-step estimates   Number of obs      =      3673
(regression model with sample selection)        Censored obs       =      2679
                                                Uncensored obs     =       994

                                                Wald chi2(39)      =    165.80
                                                Prob > chi2        =    0.0000

------------------------------------------------------------------------------
        mu_H |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
mu_H         |
         sex |  -.0341169   .0099902    -3.42   0.001    -.0536974   -.0145365
      yrsedu |   .1495903   .1305035     1.15   0.252    -.1061918    .4053725
     whiteco |   .0091435   .0128589     0.71   0.477    -.0160595    .0343464
         eta |   .0011926   .0004061     2.94   0.003     .0003966    .0019886
         A52 |  -.0837376   .0602227    -1.39   0.164    -.2017718    .0342966
         A53 |  -.2095034   .0756402    -2.77   0.006    -.3577554   -.0612514
         A54 |  -.2065934   .1003772    -2.06   0.040    -.4033292   -.0098576
         A55 |   .1371956   .1558581     0.88   0.379    -.1682806    .4426718
        com2 |    .116026   .0546255     2.12   0.034      .008962      .22309
        com3 |   .0304466   .0404566     0.75   0.452    -.0488469    .1097401
        com4 |  -.2718237    .105222    -2.58   0.010     -.478055   -.0655925
      Dnperc |  -.0024397   .0101136    -0.24   0.809     -.022262    .0173826
         lit |   .0316913   .0186291     1.70   0.089     -.004821    .0682036
      risfin |   .0194895   .0467482     0.42   0.677    -.0721352    .1111143
       risf2 |  -.0058746   .0078894    -0.74   0.457    -.0213376    .0095884
        Daf3 |  -.0122858   .0115869    -1.06   0.289    -.0349957     .010424
      p_prov |   .0479749    .097801     0.49   0.624    -.1437115    .2396613
     p_prov2 |  -.0137404   .0193733    -0.71   0.478    -.0517115    .0242307
      p_com2 |  -.0522925   .0252199    -2.07   0.038    -.1017226   -.0028624
      p_com3 |  -.0152364   .0183313    -0.83   0.406    -.0511652    .0206924
      p_com4 |   .0811534   .0397271     2.04   0.041     .0032897     .159017
       p_A52 |  -.0014722   .0255199    -0.06   0.954    -.0514904     .048546
       p_A53 |     .04221   .0277113     1.52   0.128    -.0121031    .0965232
       p_A54 |   .0871037   .0468971     1.86   0.063    -.0048131    .1790204
       p_A55 |  -.1236659   .1013543    -1.22   0.222    -.3223167     .074985
      impacq |   .0334793   .0116118     2.88   0.004     .0107206    .0562379
     impacq2 |  -4.642875   1.980103    -2.34   0.019    -8.523806    -.761944
     manstra |  -.0234605   .0128741    -1.82   0.068    -.0486933    .0017722
      anposs |  -.1667265   .1012121    -1.65   0.099    -.3650985    .0316454
      anposq |   .0419429   .0255028     1.64   0.100    -.0080416    .0919275
    Danposs0 |  -165.6671   100.4153    -1.65   0.099    -362.4773    31.14325
    piubagni |  -.0247526   .0107912    -2.29   0.022    -.0459029   -.0036023
   hprices06 |   .0405879   .0299204     1.36   0.175     -.018055    .0992307
      hpr_sq |   -.004569   .0037442    -1.22   0.222    -.0119074    .0027695
     sport04 |   .0785424   .0540316     1.45   0.146    -.0273576    .1844424
    high_grw |  -.0330868   .0272998    -1.21   0.226    -.0865934    .0204199
   trib_inef |   .0391825   .0170923     2.29   0.022     .0056822    .0726827
         va2 |   .0104027   .0057026     1.82   0.068    -.0007743    .0215796
       avgva |  -.1049208    .057602    -1.82   0.069    -.2178186     .007977
       _cons |   165.8511   100.4242     1.65   0.099    -30.97666    362.6789
-------------+----------------------------------------------------------------
select       |
     lowcomp |  -.0518317   .0763086    -0.68   0.497    -.2013938    .0977303
     verored |   .0188767   .0204374     0.92   0.356    -.0211798    .0589331
       klima |   .0239236    .025636     0.93   0.351    -.0263221    .0741692
        Dexp |  -1.099418   .0585673   -18.77   0.000    -1.214208   -.9846285
         sex |  -.0444286   .0551623    -0.81   0.421    -.1525448    .0636876
      yrsedu |   1.475307   .7310771     2.02   0.044     .0424223    2.908192
     whiteco |  -.0083274   .0764297    -0.11   0.913    -.1581268    .1414719
         eta |  -.0067802    .002172    -3.12   0.002    -.0110372   -.0025232
         A52 |  -.5052161   .3458169    -1.46   0.144    -1.183005    .1725726
         A53 |  -1.165032   .3906587    -2.98   0.003    -1.930709    -.399355
         A54 |   .7740428   .5226199     1.48   0.139    -.2502734    1.798359
         A55 |   1.384969   .6945086     1.99   0.046     .0237574    2.746181
        com2 |  -.6543733    .287258    -2.28   0.023    -1.217389    -.091358
        com3 |  -.5614418   .2181986    -2.57   0.010    -.9891031   -.1337804
        com4 |  -.5466981   .5340539    -1.02   0.306    -1.593425    .5000283
      Dnperc |   .0283313   .0552976     0.51   0.608    -.0800499    .1367126
         lit |   .3579602   .0934883     3.83   0.000     .1747264     .541194
      risfin |   .3567141   .2648699     1.35   0.178    -.1624213    .8758496
       risf2 |  -.0741664   .0441324    -1.68   0.093    -.1606644    .0123315
        Daf3 |   .1147879   .0688426     1.67   0.095    -.0201411    .2497168
      p_prov |  -.0506949   .5117105    -0.10   0.921    -1.053629    .9522393
     p_prov2 |  -.0556518   .1001391    -0.56   0.578    -.2519209    .1406173
      p_com2 |   .3700028   .1322711     2.80   0.005     .1107563    .6292494
      p_com3 |   .2510165   .0979667     2.56   0.010     .0590052    .4430277
      p_com4 |   .3065533   .2044182     1.50   0.134    -.0940989    .7072056
       p_A52 |    .139563   .1446636     0.96   0.335    -.1439726    .4230985
       p_A53 |   .3178891   .1443747     2.20   0.028     .0349199    .6008584
       p_A54 |   -.525442   .2347677    -2.24   0.025    -.9855783   -.0653057
       p_A55 |  -1.278041   .4201649    -3.04   0.002    -2.101549   -.4545325
      impacq |   .0150269   .0678683     0.22   0.825    -.1179925    .1480463
     impacq2 |  -12.14584   11.56748    -1.05   0.294    -34.81769    10.52601
     manstra |   .1395353   .0741996     1.88   0.060    -.0058934    .2849639
      anposs |   .7919526    .486071     1.63   0.103     -.160729    1.744634
      anposq |  -.1996055   .1225986    -1.63   0.103    -.4398944    .0406834
    Danposs0 |    785.333   481.7711     1.63   0.103     -158.921    1729.587
    piubagni |    .067349   .0598796     1.12   0.261    -.0500128    .1847108
   hprices06 |   .4565567    .157861     2.89   0.004     .1471548    .7659586
      hpr_sq |  -.0528375   .0201122    -2.63   0.009    -.0922567   -.0134182
     sport04 |   .3757555   .2919103     1.29   0.198    -.1963782    .9478893
    high_grw |   .1978865    .146439     1.35   0.177    -.0891287    .4849016
   trib_inef |  -.2065732    .095064    -2.17   0.030    -.3928952   -.0202512
         va2 |  -.0627676   .0286171    -2.19   0.028     -.118856   -.0066792
       avgva |   .5715188   .2938482     1.94   0.052     -.004413    1.147451
       _cons |  -787.8755   481.7831    -1.64   0.102    -1732.153    156.4021
-------------+----------------------------------------------------------------
mills        |
      lambda |   -.014299   .0156785    -0.91   0.362    -.0450283    .0164302
-------------+----------------------------------------------------------------
         rho |   -0.10139
       sigma |  .14103439
      lambda | -.01429903   .0156785
------------------------------------------------------------------------------
(option xb assumed; fitted values)
(8047 missing values generated)
(8047 missing values generated)
(8047 missing values generated)
(8047 missing values generated)
(8047 missing values generated)
(8047 missing values generated)
(6305 real changes made)
(6305 real changes made)
(6305 real changes made)
(6305 real changes made)
(6305 real changes made)
(6305 real changes made)
(option xb assumed; fitted values)
(8553 missing values generated)
(6305 real changes made)
(6305 real changes made)
(6305 real changes made)
(6305 real changes made)
(6305 real changes made)
(6305 real changes made)
(8047 missing values generated)
(8047 missing values generated)
(8047 missing values generated)
(8047 missing values generated)
(8047 missing values generated)
(8047 missing values generated)
(6305 real changes made)
(6305 real changes made)
(6305 real changes made)
(6305 real changes made)
(6305 real changes made)
(5484 real changes made)
(option xb assumed; fitted values)
(9241 missing values generated)
(6305 real changes made)
(6305 real changes made)
(6305 real changes made)
(6305 real changes made)
(6305 real changes made)
(5484 real changes made)
(14352 real changes made)
(14352 real changes made)
(14352 real changes made)
(14352 real changes made)
(14352 real changes made)
(14352 real changes made)
(option xb assumed; fitted values)
(9241 missing values generated)
(14352 real changes made)
(14352 real changes made)
(14352 real changes made)
(14352 real changes made)
(14352 real changes made)
(14352 real changes made)
(14209 missing values generated)
(8553 missing values generated)
(14676 missing values generated)
(9241 missing values generated)
(14680 missing values generated)
(9241 missing values generated)
(14680 missing values generated)
(9241 missing values generated)
(14676 missing values generated)
(9241 missing values generated)
(14209 missing values generated)
(8553 missing values generated)
(8047 missing values generated)
(14209 missing values generated)
(8553 missing values generated)
(15177 missing values generated)
(14209 missing values generated)
(15177 missing values generated)
(9534 missing values generated)
(8553 missing values generated)
(9534 missing values generated)
(14680 missing values generated)
(9241 missing values generated)
(14209 missing values generated)
(8553 missing values generated)
(14680 missing values generated)
(9241 missing values generated)
(14676 missing values generated)
(9241 missing values generated)
(14209 missing values generated)
(8553 missing values generated)
(14209 missing values generated)
(8553 missing values generated)
(15177 missing values generated)
(14209 missing values generated)
(15177 missing values generated)
(9534 missing values generated)
(8553 missing values generated)
(9534 missing values generated)
(14680 missing values generated)
(9241 missing values generated)
(14209 missing values generated)
(8553 missing values generated)
(626 observations deleted)
(10494 observations deleted)
(6 observations deleted)
(6 observations deleted)

Linear regression                                      Number of obs =     140
                                                       F( 17,   121) =       .
                                                       Prob > F      =       .
                                                       R-squared     =  0.2155
                                                       Root MSE      =  4.1739

------------------------------------------------------------------------------
             |               Robust
    delta_cn |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
  unexp_afar |   .0243679   .0162333     1.50   0.136    -.0077702    .0565059
    exp_afar |    .038974   .0162698     2.40   0.018     .0067636    .0711844
         eta |    .030618   .0429105     0.71   0.477    -.0543347    .1155707
      yrsedu |   13.00674   8.807795     1.48   0.142    -4.430609     30.4441
         sex |   .1136492   .8404434     0.14   0.893     -1.55023    1.777529
       ncomp |   .9629917   .4492894     2.14   0.034     .0735049    1.852479
       nperc |   3.238149   3.316172     0.98   0.331    -3.327088    9.803385
         np2 |  -.9928743   .7861743    -1.26   0.209    -2.549314    .5635651
     married |  -.8171642   1.525674    -0.54   0.593    -3.837638     2.20331
    employed |   .6586974   1.143902     0.58   0.566    -1.605959    2.923354
    pubblico |  -.1707215   1.021602    -0.17   0.868    -2.193252    1.851809
     selfemp |   2.493366   2.238737     1.11   0.268    -1.938804    6.925535
         A52 |   .0552804   .9690161     0.06   0.955    -1.863143    1.973703
         A53 |   .4738364   1.036781     0.46   0.648    -1.578745    2.526418
         A54 |   .5438097   1.544833     0.35   0.725    -2.514595    3.602214
         A55 |  -.4167874   1.002958    -0.42   0.678    -2.402408    1.568833
       small |   .3312646   .7634384     0.43   0.665    -1.180163    1.842692
         Dpf |   -.128713   .7144975    -0.18   0.857    -1.543249    1.285823
       _cons |   -7.94131   4.360899    -1.82   0.071    -16.57486    .6922409
------------------------------------------------------------------------------
(2585 real changes made, 2585 to missing)

Linear regression                                      Number of obs =     140
                                                       F( 19,   119) =       .
                                                       Prob > F      =       .
                                                       R-squared     =  0.2250
                                                       Root MSE      =  4.1833

------------------------------------------------------------------------------
             |               Robust
    delta_cn |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
    unexp_af |  -.2277236   .3435792    -0.66   0.509    -.9080447    .4525975
    unexp_ar |   .0216263   .0162722     1.33   0.186    -.0105944    .0538469
      exp_af |  -.1170402    .326812    -0.36   0.721    -.7641607    .5300803
      exp_ar |   .0371638   .0159255     2.33   0.021     .0056298    .0686978
         eta |   .0309512   .0429627     0.72   0.473    -.0541191    .1160216
      yrsedu |   13.15792   9.078782     1.45   0.150    -4.818972    31.13482
         sex |   .2316891    .847608     0.27   0.785     -1.44666    1.910038
       ncomp |   .9556535   .4556847     2.10   0.038     .0533523    1.857955
       nperc |    3.10288   3.300452     0.94   0.349    -3.432344    9.638103
         np2 |  -.9342892   .7737449    -1.21   0.230    -2.466381     .597803
     married |  -.8257937   1.531893    -0.54   0.591    -3.859095    2.207508
    employed |   .5067711   1.124815     0.45   0.653    -1.720475    2.734017
    pubblico |  -.0886082   1.036152    -0.09   0.932    -2.140292    1.963076
     selfemp |    2.35482   2.239575     1.05   0.295    -2.079762    6.789402
         A52 |    .352067   .9238014     0.38   0.704    -1.477152    2.181286
         A53 |   .6543504   1.067174     0.61   0.541    -1.458761    2.767462
         A54 |   .4840525   1.562561     0.31   0.757    -2.609973    3.578078
         A55 |  -.4162761   1.025841    -0.41   0.686    -2.447543    1.614991
       small |     .43755   .7824641     0.56   0.577    -1.111807    1.986907
         Dpf |  -.1980186   .7034622    -0.28   0.779    -1.590944    1.194907
       _cons |  -7.902631   4.345121    -1.82   0.071    -16.50641    .7011435
------------------------------------------------------------------------------

Heckman selection model -- two-step estimates   Number of obs      =      2211
(regression model with sample selection)        Censored obs       =      2071
                                                Uncensored obs     =       140

                                                Wald chi2(18)      =     37.38
                                                Prob > chi2        =    0.0047

------------------------------------------------------------------------------
             |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
delta_cn     |
  unexp_afar |    .023769   .0139437     1.70   0.088    -.0035602    .0510982
    exp_afar |   .0386685   .0119319     3.24   0.001     .0152825    .0620545
         eta |   .0364437   .0434253     0.84   0.401    -.0486683    .1215557
      yrsedu |   9.455338    11.8102     0.80   0.423    -13.69223    32.60291
         sex |  -.2032641   1.084995    -0.19   0.851    -2.329815    1.923287
       ncomp |   .9814909   .4452442     2.20   0.027     .1088283    1.854154
       nperc |    2.91688   2.691871     1.08   0.279    -2.359091    8.192851
         np2 |  -.9293456   .6630399    -1.40   0.161     -2.22888    .3701888
     married |  -.9286023   1.118925    -0.83   0.407    -3.121655    1.264451
    employed |   .5623586   1.231467     0.46   0.648    -1.851272     2.97599
    pubblico |  -.4415928   1.156692    -0.38   0.703    -2.708668    1.825483
     selfemp |   2.587905    1.56723     1.65   0.099    -.4838095    5.659619
         A52 |   .7941974   1.823123     0.44   0.663    -2.779058    4.367453
         A53 |   1.179209   1.757667     0.67   0.502    -2.265755    4.624172
         A54 |   1.696595    2.67409     0.63   0.526    -3.544525    6.937715
         A55 |    1.93247   6.259591     0.31   0.758     -10.3361    14.20104
       small |   .2171424   .7919933     0.27   0.784    -1.335136    1.769421
         Dpf |  -.0378677   .8035726    -0.05   0.962    -1.612841    1.537106
       _cons |  -4.849386   7.446035    -0.65   0.515    -19.44335    9.744574
-------------+----------------------------------------------------------------
respondent   |
         eta |   -.002643   .0050637    -0.52   0.602    -.0125676    .0072816
      yrsedu |   3.597514   1.187127     3.03   0.002     1.270789    5.924239
         sex |   .2463414   .1115298     2.21   0.027     .0277471    .4649358
       ncomp |   .0004108   .0531571     0.01   0.994    -.1037751    .1045967
       nperc |    .219388   .2872293     0.76   0.445    -.3435711    .7823471
         np2 |  -.0513859   .0683803    -0.75   0.452    -.1854089     .082637
     married |   .0325043   .1378087     0.24   0.814    -.2375957    .3026044
    employed |   .0475586   .1531532     0.31   0.756    -.2526162    .3477334
    pubblico |   .2512442   .1479157     1.70   0.089    -.0386653    .5411537
     selfemp |  -.1441016   .1943334    -0.74   0.458    -.5249881    .2367849
         A52 |  -.6424094   .1284971    -5.00   0.000    -.8942591   -.3905597
         A53 |  -.5146693   .1215659    -4.23   0.000    -.7529342   -.2764044
         A54 |  -.8476008   .1438457    -5.89   0.000    -1.129533   -.5656683
         A55 |  -1.557631   .3475805    -4.48   0.000    -2.238876    -.876386
       small |   .1100397   .0929129     1.18   0.236    -.0720662    .2921455
         Dpf |  -.0318897   .1066909    -0.30   0.765        -.241    .1772205
     lowcomp |   .2250913   .1199745     1.88   0.061    -.0100543    .4602369
     verored |  -.0293283   .0373619    -0.78   0.432    -.1025563    .0438998
       klima |   .1231227   .0454123     2.71   0.007     .0341162    .2121293
       _cons |  -2.646534   .5757739    -4.60   0.000     -3.77503   -1.518038
-------------+----------------------------------------------------------------
mills        |
      lambda |   -1.52466   3.133057    -0.49   0.627    -7.665339     4.61602
-------------+----------------------------------------------------------------
         rho |   -0.37037
       sigma |  4.1166233
      lambda | -1.5246596   3.133057
------------------------------------------------------------------------------

Heckman selection model -- two-step estimates   Number of obs      =      2211
(regression model with sample selection)        Censored obs       =      2071
                                                Uncensored obs     =       140

                                                Wald chi2(20)      =     39.59
                                                Prob > chi2        =    0.0056

------------------------------------------------------------------------------
             |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
delta_cn     |
    unexp_af |  -.2398969   .4094048    -0.59   0.558    -1.042315    .5625217
    unexp_ar |   .0210998   .0140118     1.51   0.132    -.0063628    .0485623
      exp_af |  -.1300006   .3824283    -0.34   0.734    -.8795462    .6195451
      exp_ar |   .0369066    .011937     3.09   0.002     .0135105    .0603028
         eta |   .0366133   .0437196     0.84   0.402    -.0490755    .1223021
      yrsedu |   9.944523   11.84734     0.84   0.401    -13.27584    33.16489
         sex |  -.0599256   1.083769    -0.06   0.956    -2.184075    2.064224
       ncomp |   .9726782   .4420134     2.20   0.028     .1063478    1.839009
       nperc |   2.808091   2.673839     1.05   0.294    -2.432538    8.048719
         np2 |  -.8749003   .6604542    -1.32   0.185    -2.169367    .4195661
     married |  -.9315537   1.113219    -0.84   0.403    -3.113422    1.250315
    employed |   .4155074   1.231134     0.34   0.736    -1.997471    2.828486
    pubblico |   -.343179   1.153767    -0.30   0.766     -2.60452    1.918162
     selfemp |   2.440979    1.56075     1.56   0.118    -.6180351    5.499993
         A52 |   1.033402   1.819213     0.57   0.570    -2.532189    4.598993
         A53 |   1.304052   1.747549     0.75   0.456    -2.121081    4.729185
         A54 |   1.550592   2.657536     0.58   0.560    -3.658083    6.759266
         A55 |   1.765512   6.227898     0.28   0.777    -10.44094    13.97197
       small |   .3310355   .7909144     0.42   0.676    -1.219128    1.881199
         Dpf |  -.1151934   .8008134    -0.14   0.886    -1.684759    1.454372
       _cons |  -5.047324    7.39119    -0.68   0.495    -19.53379    9.439142
-------------+----------------------------------------------------------------
respondent   |
         eta |   -.002643   .0050637    -0.52   0.602    -.0125676    .0072816
      yrsedu |   3.597514   1.187127     3.03   0.002     1.270789    5.924239
         sex |   .2463414   .1115298     2.21   0.027     .0277471    .4649358
       ncomp |   .0004108   .0531571     0.01   0.994    -.1037751    .1045967
       nperc |    .219388   .2872293     0.76   0.445    -.3435711    .7823471
         np2 |  -.0513859   .0683803    -0.75   0.452    -.1854089     .082637
     married |   .0325043   .1378087     0.24   0.814    -.2375957    .3026044
    employed |   .0475586   .1531532     0.31   0.756    -.2526162    .3477334
    pubblico |   .2512442   .1479157     1.70   0.089    -.0386653    .5411537
     selfemp |  -.1441016   .1943334    -0.74   0.458    -.5249881    .2367849
         A52 |  -.6424094   .1284971    -5.00   0.000    -.8942591   -.3905597
         A53 |  -.5146693   .1215659    -4.23   0.000    -.7529342   -.2764044
         A54 |  -.8476008   .1438457    -5.89   0.000    -1.129533   -.5656683
         A55 |  -1.557631   .3475805    -4.48   0.000    -2.238876    -.876386
       small |   .1100397   .0929129     1.18   0.236    -.0720662    .2921455
         Dpf |  -.0318897   .1066909    -0.30   0.765        -.241    .1772205
     lowcomp |   .2250913   .1199745     1.88   0.061    -.0100543    .4602369
     verored |  -.0293283   .0373619    -0.78   0.432    -.1025563    .0438998
       klima |   .1231227   .0454123     2.71   0.007     .0341162    .2121293
       _cons |  -2.646534   .5757739    -4.60   0.000     -3.77503   -1.518038
-------------+----------------------------------------------------------------
mills        |
      lambda |   -1.41812   3.122144    -0.45   0.650    -7.537409    4.701169
-------------+----------------------------------------------------------------
         rho |   -0.34902
       sigma |  4.0631953
      lambda | -1.4181195   3.122144
------------------------------------------------------------------------------

Linear regression                                      Number of obs =     140
                                                       F( 17,   121) =       .
                                                       Prob > F      =       .
                                                       R-squared     =  0.2178
                                                       Root MSE      =   4.168

------------------------------------------------------------------------------
             |               Robust
    delta_cn |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
unexp_afarhk |   .0243761   .0160898     1.51   0.132     -.007478    .0562301
  exp_afarhk |   .0396383    .016051     2.47   0.015     .0078611    .0714155
         eta |   .0293909   .0430756     0.68   0.496    -.0558887    .1146705
      yrsedu |   13.02337   8.719263     1.49   0.138    -4.238709    30.28545
         sex |   .1349163   .8410437     0.16   0.873    -1.530152    1.799984
       ncomp |   .9491068   .4496437     2.11   0.037     .0589185    1.839295
       nperc |   3.123509   3.307781     0.94   0.347    -3.425116    9.672133
         np2 |   -.960551   .7831382    -1.23   0.222     -2.51098    .5898776
     married |  -.8188113    1.52492    -0.54   0.592    -3.837792     2.20017
    employed |   .6562942   1.135814     0.58   0.564     -1.59235    2.904938
    pubblico |  -.1679024   1.021495    -0.16   0.870     -2.19022    1.854415
     selfemp |   2.559993   2.248453     1.14   0.257    -1.891412    7.011398
         A52 |   .0889628     .98016     0.09   0.928    -1.851522    2.029448
         A53 |   .4795989   1.032204     0.46   0.643     -1.56392    2.523118
         A54 |   .5669014   1.550795     0.37   0.715    -2.503305    3.637108
         A55 |  -.4163136   1.003117    -0.42   0.679    -2.402249    1.569621
       small |   .3222732   .7616169     0.42   0.673    -1.185548    1.830095
         Dpf |  -.1290474   .7127298    -0.18   0.857    -1.540084    1.281989
       _cons |  -7.783716   4.366303    -1.78   0.077    -16.42796    .8605319
------------------------------------------------------------------------------

Linear regression                                      Number of obs =     140
                                                       F( 19,   119) =       .
                                                       Prob > F      =       .
                                                       R-squared     =  0.2446
                                                       Root MSE      =  4.1302

------------------------------------------------------------------------------
             |               Robust
    delta_cn |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
  unexp_afhk |   .0068977    .248642     0.03   0.978    -.4854382    .4992337
  unexp_arhk |   .0257968   .0159318     1.62   0.108    -.0057498    .0573434
    exp_afhk |   .1657218   .2583064     0.64   0.522    -.3457507    .6771942
    exp_arhk |   .0431625   .0156554     2.76   0.007     .0121633    .0741616
         eta |   .0239894   .0425751     0.56   0.574    -.0603136    .1082924
      yrsedu |    14.3279   9.163243     1.56   0.121    -3.816235    32.47204
         sex |   .2918389   .8421482     0.35   0.730    -1.375699    1.959376
       ncomp |   .9193411   .4523524     2.03   0.044     .0236382    1.815044
       nperc |   2.422267   3.156366     0.77   0.444    -3.827654    8.672188
         np2 |  -.7446605   .7280882    -1.02   0.308    -2.186348    .6970269
     married |  -.7255411   1.498029    -0.48   0.629    -3.691788    2.240706
    employed |   .4133474   1.123807     0.37   0.714    -1.811903    2.638598
    pubblico |  -.0924449   1.042449    -0.09   0.929    -2.156597    1.971707
     selfemp |   2.206282   2.285219     0.97   0.336    -2.318681    6.731245
         A52 |   .5399708    .941308     0.57   0.567    -1.323913    2.403855
         A53 |   .6651535    1.05992     0.63   0.532    -1.433594    2.763901
         A54 |   .6435993   1.566259     0.41   0.682     -2.45775    3.744949
         A55 |  -.5229688    1.02395    -0.51   0.610    -2.550493    1.504555
       small |   .2851525   .7628938     0.37   0.709    -1.225453    1.795759
         Dpf |  -.0263476   .6999209    -0.04   0.970    -1.412261    1.359566
       _cons |  -7.168905    4.23096    -1.69   0.093    -15.54663    1.208819
------------------------------------------------------------------------------

Linear regression                                      Number of obs =    1033
                                                       F( 18,  1014) =    1.22
                                                       Prob > F      =  0.2343
                                                       R-squared     =  0.0219
                                                       Root MSE      =  3.9922

------------------------------------------------------------------------------
             |               Robust
    delta_cn |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
unexp_afarhk |   .0001004   .0085882     0.01   0.991    -.0167524    .0169531
  exp_afarhk |    .002526   .0086589     0.29   0.771    -.0144654    .0195173
         eta |  -.0103764   .0129327    -0.80   0.423    -.0357542    .0150014
      yrsedu |   1.340813   3.658612     0.37   0.714    -5.838505    8.520131
         sex |   .6936788    .325948     2.13   0.034     .0540691    1.333289
       ncomp |   .1488172   .1527295     0.97   0.330    -.1508849    .4485192
       nperc |   2.011696   .7932385     2.54   0.011     .4551192    3.568273
         np2 |  -.5123944   .1895714    -2.70   0.007    -.8843916   -.1403972
     married |   -.838194   .3702095    -2.26   0.024    -1.564658   -.1117296
    employed |  -.9140364   .3799854    -2.41   0.016    -1.659684   -.1683886
    pubblico |   .9725155   .5824278     1.67   0.095    -.1703863    2.115417
     selfemp |  -.5461731   .6291917    -0.87   0.386     -1.78084    .6884936
         A52 |   .2878549   .4128337     0.70   0.486    -.5222512    1.097961
         A53 |   .0489971   .3885729     0.13   0.900     -.713502    .8114962
         A54 |  -.1376184   .3469228    -0.40   0.692    -.8183872    .5431504
         A55 |   .3440567   .3675619     0.94   0.349    -.3772124    1.065326
       small |  -.1745099   .2630664    -0.66   0.507    -.6907267     .341707
         Dpf |   .1163496   .3415777     0.34   0.733    -.5539305    .7866296
       _cons |  -.8129563   1.233736    -0.66   0.510    -3.233925    1.608012
------------------------------------------------------------------------------

Linear regression                                      Number of obs =    1033
                                                       F( 20,  1012) =    1.13
                                                       Prob > F      =  0.3096
                                                       R-squared     =  0.0224
                                                       Root MSE      =  3.9952

------------------------------------------------------------------------------
             |               Robust
    delta_cn |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
  unexp_afhk |  -.0053866   .1372674    -0.04   0.969    -.2747479    .2639747
  unexp_arhk |  -.0003366   .0086188    -0.04   0.969    -.0172493    .0165761
    exp_afhk |   .0384958   .1099292     0.35   0.726    -.1772195    .2542111
    exp_arhk |   .0020212   .0087237     0.23   0.817    -.0150975    .0191399
         eta |  -.0102914   .0129394    -0.80   0.427    -.0356824    .0150997
      yrsedu |   1.277339   3.652113     0.35   0.727    -5.889242     8.44392
         sex |   .6932066   .3271602     2.12   0.034     .0512167    1.335197
       ncomp |   .1470831   .1523242     0.97   0.334    -.1518244    .4459905
       nperc |   1.991589   .7944579     2.51   0.012     .4326159    3.550563
         np2 |  -.5079494   .1897059    -2.68   0.008    -.8802113   -.1356875
     married |  -.8230681   .3685925    -2.23   0.026    -1.546361   -.0997749
    employed |  -.9097955   .3798083    -2.40   0.017    -1.655097   -.1644936
    pubblico |   .9891916   .5809527     1.70   0.089    -.1508181    2.129201
     selfemp |  -.5527443   .6309161    -0.88   0.381    -1.790798    .6853093
         A52 |   .3029307   .4121996     0.73   0.463    -.5059331    1.111795
         A53 |   .0593058   .3891478     0.15   0.879    -.7043232    .8229347
         A54 |   -.140868   .3473235    -0.41   0.685    -.8224246    .5406887
         A55 |   .3379398   .3658959     0.92   0.356    -.3800618    1.055941
       small |  -.1660307   .2648559    -0.63   0.531    -.6857603    .3536989
         Dpf |   .1179677   .3428888     0.34   0.731    -.5548867    .7908221
       _cons |  -.8019552   1.237106    -0.65   0.517    -3.229541    1.625631
------------------------------------------------------------------------------

.         
.         #delimit;       
delimiter now ;
.         matrix define results=  reg1\reg2\reg3\reg4\reg5\reg6\reg7\reg8\reg9\reg10\reg11\reg12\
>         /*K x 1 matrix*/                reg13\reg14\reg15\reg16\reg17\reg18\reg19\reg20\reg21\reg22\reg23\reg24;

.                         #delimit cr
delimiter now cr
.         svmat results           /*Creates a variable whose values coincide with the K elements (coefficients) of th
> e matrix*/

.         keep results

.         keep if results!=.      /*WHY SHOULD THERE BE MISSING?*/
(4772 observations deleted)

.         gen repl=0      

.         save rep,replace        /*Dataset of 2 variables (results and repl) and K obs*/
(note: file rep.dta not found)
file rep.dta saved

. 
.         
. cap program drop doit

. program def doit
  1.           local i=1
  2.         while `i' < 1000 {
  3.                 u databoot,clear
  4.                 bsample
  5.                 *bsample, cluster(nquest) id(id) strata(panel)          /*HERE... WHAT?*/
.                 qui weeffect    /*Run the estimation program*/
  6.                 
.                 #delimit;       
delimiter now ;
.             matrix define results=      reg1\reg2\reg3\reg4\reg5\reg6\reg7\reg8\reg9\reg10\reg11\reg12\
>                                                                 reg13\reg14\reg15\reg16\reg17\reg18\reg19\reg20\reg
> 21\reg22\reg23\reg24;
  7.                 #delimit cr
delimiter now cr
.                 svmat results
  8.                 keep results
  9.                 keep if results!=.
 10.                 gen repl=`i'    /*Tracks the number of bootstrap, from 1 to 1000*/
 11.                 save rep`i',replace
 12.                 u rep,clear
 13.                 append using rep`i'
 14.                 erase rep`i'.dta
 15.                 save rep,replace                /*Dataset of 2 variables and K+iK obs*/
 16.         local i=`i'+1
 17.                 }
 18. end

. qui doit

. 
. u rep,clear

. replace repl=repl+1                             /*From 1 to 1001*/
(24000 real changes made)

. gen p=1

. sort repl

. qui by repl:replace p=sum(p)    /*Running sum of p, by repl (p goes from 1 to k coefficients)*/

. ren results1 coeff

. reshape wide coeff,i(repl) j(p)
(note: j = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24)

Data                               long   ->   wide
-----------------------------------------------------------------------------
Number of obs.                    24000   ->    1000
Number of variables                   3   ->      25
j variable (24 values)                p   ->   (dropped)
xij variables:
                                  coeff   ->   coeff1 coeff2 ... coeff24
-----------------------------------------------------------------------------

. compress
repl was float now int

. save rep,replace                                /*K variables*/
file rep.dta saved

. 
. /***************************************************************************************************/
. /*Now I compute the P-VALUES!!!*/
. /***************************************************************************************************/
. 
. u databoot,clear

. 
. /******FIT H*****/
. qui     heckman mu_H sex yrsedu whiteco eta A52-A55 com2-com4 Dnperc lit risfin risf2 Daf3 /*
> */ p_prov p_prov2 p_com2-p_com4 p_A5* impacq* manstra anposs anposq Danposs piubagni /*
> */ hprices06 hpr_sq sport04 high_grw trib_inef va2 avgva if rotaz==1 & x_cas==0, /*
> */ select(lowcomp verored klima Dexp sex sex yrsedu whiteco eta A52-A55 com2-com4 Dnperc lit risfin risf2 Daf3 /*
> */ p_prov p_prov2 p_com2-p_com4 p_A5* impacq* manstra anposs anposq Danposs piubagni /*
> */ hprices06 hpr_sq sport04 high_grw trib_inef va2 avgva) nolog twostep 

. 
. predict mu_Hh_heck                      /*Valabit is missing for a handful of households*/
(option xb assumed; fitted values)

.                                                                                 /*1ST FITTED REGRESSOR*/
. 
. sort nq anno

. qui by nq: gen mu_H10=mu_H[_n+1]

. lab var mu_H10 "Expected return on housing in 2010 (for those in the panel)"

.                                 
. /******FIT FTSE*****/
. gen x1=FTSEm_l1
(7951 missing values generated)

. gen x2=FTSEm_l2
(7951 missing values generated)

. gen x3=FTSEm_l3
(7951 missing values generated)

. gen x4=FTSEm_l4
(7951 missing values generated)

. gen x5=FTSEm_l5
(7951 missing values generated)

. gen x6=FTSEm_l6
(7951 missing values generated)

. 
. qui heckman mu_R sex yrsedu whiteco eta A52-A55 com2-com4 Dnperc lit risfin risf2 Daf3 /*
> */ FTSEm_l1 FTSEm_l2 FTSEm_l3 FTSEm_l4 FTSEm_l5 FTSEm_l6 hprices06 hpr_ sport04 /*
> */ trib_inef high_grw va2 avgva if x_bor==0, /*
> */ select(lowcomp verored klima Dexp2 sex yrsedu whiteco eta A52-A55 com2-com4 lit Dnperc risfin risf2/*
> */ Daf3 FTSEm_l1 FTSEm_l2 FTSEm_l3 FTSEm_l4 FTSEm_l5 FTSEm_l6 hprices06 hpr_ sport04 /*
> */ trib_inef high_grw va2 avgva) nolog twostep

. 
. replace FTSEm_l1=FTSEmo12
(6402 real changes made)

. replace FTSEm_l2=FTSEmo11
(6402 real changes made)

. replace FTSEm_l3=FTSEmo10 
(6402 real changes made)

. replace FTSEm_l4=FTSEmo9
(6402 real changes made)

. replace FTSEm_l5=FTSEmo8
(6402 real changes made)

. replace FTSEm_l6=FTSEmo7
(6402 real changes made)

. predict mu_Rh_heck if x_bor==0  /*2ND FITTED REGRESSOR*/
(option xb assumed; fitted values)
(8462 missing values generated)

. 
. replace FTSEm_l1=x1
(6402 real changes made)

. replace FTSEm_l2=x2
(6402 real changes made)

. replace FTSEm_l3=x3 
(6402 real changes made)

. replace FTSEm_l4=x4
(6402 real changes made)

. replace FTSEm_l5=x5
(6402 real changes made)

. replace FTSEm_l6=x6
(6402 real changes made)

. drop x1-x6

. 
. /******FIT Bank deposits*****/
. gen x1=bank_l1
(7951 missing values generated)

. gen x2=bank_l2
(7951 missing values generated)

. gen x3=bank_l3
(7951 missing values generated)

. gen x4=bank_l4
(7951 missing values generated)

. gen x5=bank_l5
(7951 missing values generated)

. gen x6=bank_l6
(7951 missing values generated)

. 
. qui heckman mu_rf sex yrsedu whiteco eta A52-A55 com2-com4 Dnperc lit risfin risf2 Daf3 /*
> */ bank_l1 bank_l2 bank_l3 bank_l4 bank_l5 bank_l6 hprices06 hpr_ sport04 /*
> */ trib_inef high_grw va2 avgva if x_int==0, /*
> */ select(lowcomp verored klima Dexp1 sex yrsedu whiteco eta A52-A55 com2-com4 Dnperc lit risfin risf2/*
> */ Daf3 bank_l1 bank_l2 bank_l3 bank_l4 bank_l5 bank_l6 hprices06 hpr_ sport04 /*
> */ trib_inef high_grw va2 avgva) nolog twostep

. 
. replace bank_l1=bankdep12
(6402 real changes made)

. replace bank_l2=bankdep11
(6402 real changes made)

. replace bank_l3=bankdep10 
(6402 real changes made)

. replace bank_l4=bankdep9
(6402 real changes made)

. replace bank_l5=bankdep8
(6402 real changes made)

. replace bank_l6=bankdep7
(5574 real changes made)

. predict mu_rfh_heck if x_int==0         /*3RD FITTED REGRESSOR*/
(option xb assumed; fitted values)
(9131 missing values generated)

. 
. replace bank_l1=x1
(6402 real changes made)

. replace bank_l2=x2
(6402 real changes made)

. replace bank_l3=x3 
(6402 real changes made)

. replace bank_l4=x4
(6402 real changes made)

. replace bank_l5=x5
(6402 real changes made)

. replace bank_l6=x6
(5574 real changes made)

. drop x1-x6

.                         
. /******FIT Government bonds*****/
. gen x1=bonds_l1

. gen x2=bonds_l2

. gen x3=bonds_l3

. gen x4=bonds_l4

. gen x5=bonds_l5

. gen x6=bonds_l6

. 
. qui heckman mu_rbnd sex yrsedu whiteco eta A52-A55 com2-com4 Dnperc lit risfin risf2 Daf3 /*
> */ bonds_l1 bonds_l2 bonds_l3 bonds_l4 bonds_l5 bonds_l6 hprices06 hpr_ sport04 /*
> */ trib_inef high_grw va2 avgva if x_int==0, /*
> */ select(lowcomp verored klima Dexp1 sex yrsedu whiteco eta A52-A55 com2-com4 Dnperc lit risfin risf2/*
> */ Daf3 bonds_l1 bonds_l2 bonds_l3 bonds_l4 bonds_l5 bonds_l6 hprices06 hpr_ sport04 /*
> */ trib_inef high_grw va2 avgva) nolog twostep

. 
. replace bonds_l1=bonds12
(14353 real changes made)

. replace bonds_l2=bonds11
(14353 real changes made)

. replace bonds_l3=bonds10 
(14353 real changes made)

. replace bonds_l4=bonds9
(14353 real changes made)

. replace bonds_l5=bonds8
(14353 real changes made)

. replace bonds_l6=bonds7
(14353 real changes made)

. predict mu_rbndh_heck if x_int==0       /*4TH FITTED REGRESSOR*/
(option xb assumed; fitted values)
(9131 missing values generated)

. 
. replace bonds_l1=x1
(14353 real changes made)

. replace bonds_l2=x2
(14353 real changes made)

. replace bonds_l3=x3 
(14353 real changes made)

. replace bonds_l4=x4
(14353 real changes made)

. replace bonds_l5=x5
(14353 real changes made)

. replace bonds_l6=x6
(14353 real changes made)

. drop x1-x6

.                         
. /**************************************************************************************/
. 
. /********** COMPUTE (1+rho)E08(R09) (expectation)**********/
. #delimit;
delimiter now ;
. gen exp_R  =(1+0.4558194)*mu_R;
(14225 missing values generated)

. gen exp_Rhk=(1+0.4558194)*mu_Rh_heck;
(8462 missing values generated)

. gen exp_bnd  =(1+0.7531304)*mu_rbnd;
(14724 missing values generated)

. gen exp_bndhk=(1+0.7531304)*mu_rbndh_heck;
(9131 missing values generated)

. gen exp_rf  =(1+0.739289)*mu_rf;
(14726 missing values generated)

. gen exp_rfhk=(1+0.739289)*mu_rfh_heck;
(9131 missing values generated)

. gen exp_Hhk=2*mu_Hh_heck;

. /********NOW CONSTRUCT the regressors**********************/
> /*... unexpected shocks...*/
> gen unexp_af1  =af1*(Rrf-exp_rf);
(14726 missing values generated)

. gen unexp_af1hk=af1*(Rrf-exp_rfhk);
(9131 missing values generated)

. gen unexp_af2  =af2*(Rbnd-exp_bnd);
(14724 missing values generated)

.                 /*Many zeros for non-holders!*/
> gen unexp_af2hk=af2*(Rbnd-exp_bndhk);
(9131 missing values generated)

. gen unexp_af3  =af3*(RR-exp_R);
(14225 missing values generated)

. gen unexp_af3hk=af3*(RR-exp_Rhk);
(8462 missing values generated)

. gen unexp_ar1hk=ar1*(RH-exp_Hhk);
(7951 missing values generated)

. gen unexp_ar2  =ar2*(RR-exp_R);
(14225 missing values generated)

. gen unexp_ar2hk=ar2*(RR-exp_Rhk);
(8462 missing values generated)

. gen unexp_af  =unexp_af1+unexp_af2+unexp_af3;
(15193 missing values generated)

. gen unexp_ar  =unexp_ar1hk+unexp_ar2;
(14225 missing values generated)

. gen unexp_afar=unexp_af+unexp_ar;
(15193 missing values generated)

. gen unexp_afhk=unexp_af1hk+unexp_af2hk+unexp_af3hk;
(9425 missing values generated)

. gen unexp_arhk=unexp_ar1hk+unexp_ar2hk;
(8462 missing values generated)

. gen unexp_afarhk=unexp_afhk+unexp_arhk;
(9425 missing values generated)

. gen unexp_af12  = unexp_af1  +unexp_af2;
(14729 missing values generated)

. gen unexp_af12hk= unexp_af1hk+unexp_af2hk;
(9131 missing values generated)

. gen unexp_af3ar2  = unexp_af3  +unexp_ar2;
(14225 missing values generated)

. gen unexp_af3ar2hk= unexp_af3hk+unexp_ar2hk;
(8462 missing values generated)

. /* ... and anticipated changes */
> gen exp_af1  =af1*exp_rf;
(14726 missing values generated)

. gen exp_af1hk=af1*exp_rfhk;
(9131 missing values generated)

. gen exp_af2  =af2*exp_bnd;
(14724 missing values generated)

. gen exp_af2hk=af2*exp_bndhk;
(9131 missing values generated)

. gen exp_af3  =af3*exp_R;
(14225 missing values generated)

. gen exp_af3hk=af3*exp_Rhk;
(8462 missing values generated)

. gen exp_ar1hk=ar1*exp_Hhk;

. gen exp_ar2  =ar2*exp_R;
(14225 missing values generated)

. gen exp_ar2hk=ar2*exp_Rhk;
(8462 missing values generated)

. gen exp_af  =exp_af1+exp_af2+exp_af3;
(15193 missing values generated)

. gen exp_ar  =exp_ar1hk+exp_ar2;
(14225 missing values generated)

. gen exp_afar=exp_af+exp_ar;
(15193 missing values generated)

. gen exp_afhk=exp_af1hk+exp_af2hk+exp_af3hk;
(9425 missing values generated)

. gen exp_arhk=exp_ar1hk+exp_ar2hk;
(8462 missing values generated)

. gen exp_afarhk=exp_afhk+exp_arhk;
(9425 missing values generated)

. gen exp_af12 =exp_af1 +exp_af2;
(14729 missing values generated)

. gen exp_af12hk=exp_af1hk+exp_af2hk;
(9131 missing values generated)

. gen exp_af3ar2  = exp_af3  +exp_ar2;
(14225 missing values generated)

. gen exp_af3ar2hk= exp_af3hk+exp_ar2hk;
(8462 missing values generated)

. gen afar=af+ar;

.                         /*2008-2010 panel*/
> drop if (eta<20 | eta>80) & anno==2008;
(663 observations deleted)

. sort nq anno;

.  qui by nq: gen N=_N;

.  keep if N==2;
(6713 observations deleted)

.  drop N;

. sort nq anno;

.  qui by nq: gen delta_cn=(cn[_n+1]-cn)/1000;

. qui by nq: gen cngrw =(cn[_n+1]-cn)/cn;

. drop if cngrw<-0.5 | (cngrw>2 & cngrw!=.);
(59 observations deleted)

.  drop cngrw;

.                         sort nq anno;

.  qui by nq: gen N=_N;

.  keep if N==2;
(59 observations deleted)

.  drop N;

. /************************************************************************/
> /****                    WEALTH REGRESSIONS (TABLE 4)                ****/
> /************************************************************************/
> 
> #delimit cr
delimiter now cr
. 
. /*REGRESSIONS WITH EXPECTATIONS (Sample of respondents)*/
. /*ONE: af+ar*/
. reg delta_cn unexp_afar exp_afar eta yrsedu* sex ncomp nperc np2 married employed pubblico self A52-A55 small Dpf /
> *
> */ if afar>0 & mu_R!=. & mu_rf!=. & afar<2000, r

Linear regression                                      Number of obs =     410
                                                       F( 18,   391) =    1.67
                                                       Prob > F      =  0.0420
                                                       R-squared     =  0.1076
                                                       Root MSE      =  6.8696

------------------------------------------------------------------------------
             |               Robust
    delta_cn |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
  unexp_afar |   .0306504   .0166597     1.84   0.067    -.0021035    .0634043
    exp_afar |   .0346934   .0163246     2.13   0.034     .0025984    .0667884
         eta |  -.0193425   .0431125    -0.45   0.654    -.1041039    .0654188
      yrsedu |   9.599366   10.85354     0.88   0.377    -11.73923    30.93796
         sex |   .6360858   .6861124     0.93   0.354    -.7128452    1.985017
       ncomp |    .019527   .4842404     0.04   0.968    -.9325136    .9715677
       nperc |   4.452202   2.688011     1.66   0.098    -.8325613    9.736966
         np2 |  -1.358795   .6955278    -1.95   0.051    -2.726237    .0086471
     married |  -.3368286   1.010284    -0.33   0.739    -2.323098    1.649441
    employed |   .5718751   1.233641     0.46   0.643    -1.853525    2.997275
    pubblico |  -.6561697   1.202198    -0.55   0.586    -3.019751    1.707412
     selfemp |   .8085455   1.552897     0.52   0.603    -2.244528    3.861619
         A52 |   2.429578   1.029744     2.36   0.019     .4050514    4.454105
         A53 |   1.951462   1.227792     1.59   0.113    -.4624383    4.365362
         A54 |  -.5707078     1.2268    -0.47   0.642    -2.982657    1.841241
         A55 |   3.022321   2.015653     1.50   0.135    -.9405524    6.985195
       small |  -.0938474   .7461884    -0.13   0.900    -1.560891    1.373196
         Dpf |  -1.748715   .8016992    -2.18   0.030    -3.324895    -.172534
       _cons |  -2.227806   4.351856    -0.51   0.609    -10.78377    6.328159
------------------------------------------------------------------------------

. gen respondent=e(sample)

. replace respondent=. if anno==2010
(4217 real changes made, 4217 to missing)

. 
. /*Now, I must save the coefficients*/
.                         scalar def reg1=_b[unexp_afar]

.                         scalar def reg2=_b[exp_afar] 

.                                         
. /*TWO: af, ar*/
. reg delta_cn unexp_af unexp_ar exp_af exp_ar eta yrsedu* sex ncomp nperc np2 married employed pubblico self A52-A55
>  small Dpf /*
> */ if afar>0 & mu_R!=. & mu_rf!=. & afar<2000, r

Linear regression                                      Number of obs =     410
                                                       F( 20,   389) =    1.52
                                                       Prob > F      =  0.0717
                                                       R-squared     =  0.1088
                                                       Root MSE      =  6.8826

------------------------------------------------------------------------------
             |               Robust
    delta_cn |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
    unexp_af |  -.0653729   .2352161    -0.28   0.781    -.5278268     .397081
    unexp_ar |   .0302857   .0169482     1.79   0.075    -.0030359    .0636073
      exp_af |  -.0264335   .2242128    -0.12   0.906     -.467254     .414387
      exp_ar |   .0341058   .0166892     2.04   0.042     .0012935    .0669182
         eta |  -.0166176   .0442179    -0.38   0.707    -.1035536    .0703185
      yrsedu |   10.34839   11.11261     0.93   0.352     -11.4999    32.19668
         sex |   .6203772   .6859065     0.90   0.366    -.7281706    1.968925
       ncomp |   .0436755   .4962436     0.09   0.930    -.9319796    1.019331
       nperc |   4.453858   2.693775     1.65   0.099    -.8423218    9.750037
         np2 |  -1.361067   .6958747    -1.96   0.051    -2.729213    .0070787
     married |  -.3222366   1.010706    -0.32   0.750    -2.309367    1.664894
    employed |   .5706341   1.240749     0.46   0.646    -1.868779    3.010047
    pubblico |  -.6753039    1.20966    -0.56   0.577    -3.053593    1.702985
     selfemp |    .911206   1.610989     0.57   0.572    -2.256129    4.078541
         A52 |   2.485611   1.058558     2.35   0.019     .4044003    4.566823
         A53 |   1.935789   1.237157     1.56   0.118     -.496562     4.36814
         A54 |  -.6567366   1.246827    -0.53   0.599    -3.108099    1.794626
         A55 |   2.913435   2.029327     1.44   0.152    -1.076388    6.903257
       small |  -.0973719   .7480849    -0.13   0.897    -1.568167    1.373424
         Dpf |  -1.821917   .8148713    -2.24   0.026     -3.42402   -.2198141
       _cons |  -2.404066    4.44574    -0.54   0.589    -11.14475    6.336618
------------------------------------------------------------------------------

. scalar def reg3=_b[unexp_af]

. scalar def reg4=_b[unexp_ar]

. scalar def reg5=_b[exp_af]

. scalar def reg6=_b[exp_ar]

. 
. /*NEW*/         
. /*THREE: af+ar, selection*/
. heckman delta_cn unexp_afar exp_afar eta yrsedu* sex ncomp nperc np2 married employed pubblico self A52-A55 small D
> pf, ///
> select(respondent=/*unexp_afar exp_afar*/ eta yrsedu* sex ncomp nperc np2 married employed pubblico self A52-A55 sm
> all Dpf ///
> lowcomp verored klima) two

Heckman selection model -- two-step estimates   Number of obs      =      4217
(regression model with sample selection)        Censored obs       =      3807
                                                Uncensored obs     =       410

                                                Wald chi2(18)      =     48.60
                                                Prob > chi2        =    0.0001

------------------------------------------------------------------------------
             |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
delta_cn     |
  unexp_afar |   .0304661    .010969     2.78   0.005     .0089672     .051965
    exp_afar |   .0345298   .0111768     3.09   0.002     .0126238    .0564359
         eta |  -.0216922   .0404382    -0.54   0.592    -.1009496    .0575653
      yrsedu |   12.71028    15.4386     0.82   0.410    -17.54882    42.96938
         sex |   .7749043   .9958124     0.78   0.436    -1.176852    2.726661
       ncomp |   .0493773   .4539573     0.11   0.913    -.8403627    .9391173
       nperc |   4.747602   2.267335     2.09   0.036     .3037061    9.191497
         np2 |  -1.414835   .5012957    -2.82   0.005    -2.397357   -.4323139
     married |  -.3537543   1.018057    -0.35   0.728     -2.34911    1.641602
    employed |   .5031242   1.172395     0.43   0.668    -1.794728    2.800976
    pubblico |  -.6030152   1.143212    -0.53   0.598     -2.84367    1.637639
     selfemp |   .7837792   1.283385     0.61   0.541     -1.73161    3.299168
         A52 |   1.908233   2.233741     0.85   0.393    -2.469819    6.286286
         A53 |   1.558775   1.805363     0.86   0.388    -1.979671     5.09722
         A54 |  -1.192159   2.673693    -0.45   0.656    -6.432502    4.048184
         A55 |   1.999869   4.752183     0.42   0.674    -7.314238    11.31398
       small |   .0362986   .8783546     0.04   0.967    -1.685245    1.757842
         Dpf |  -1.765176   .7544805    -2.34   0.019    -3.243931   -.2864217
       _cons |  -4.018322    7.76665    -0.52   0.605    -19.24068    11.20403
-------------+----------------------------------------------------------------
respondent   |
         eta |  -.0037757   .0032617    -1.16   0.247    -.0101685     .002617
      yrsedu |   5.453673   .7778335     7.01   0.000     3.929147    6.978199
         sex |   .2304977   .0706097     3.26   0.001     .0921052    .3688901
       ncomp |   .0447366   .0358559     1.25   0.212    -.0255397    .1150128
       nperc |    .487407   .1670576     2.92   0.004     .1599802    .8148339
         np2 |  -.0962323   .0382612    -2.52   0.012    -.1712228   -.0212418
     married |  -.0255422   .0884887    -0.29   0.773    -.1989768    .1478925
    employed |  -.1365863    .095406    -1.43   0.152    -.3235786     .050406
    pubblico |   .1034926   .0981588     1.05   0.292    -.0888952    .2958803
     selfemp |   -.072878   .1097722    -0.66   0.507    -.2880276    .1422715
         A52 |  -.7650477   .0805088    -9.50   0.000     -.922842   -.6072534
         A53 |  -.5563093   .0795953    -6.99   0.000    -.7123132   -.4003054
         A54 |  -.9300174   .0910521   -10.21   0.000    -1.108476   -.7515584
         A55 |  -1.443284   .1616098    -8.93   0.000    -1.760033   -1.126534
       small |   .2082193   .0597656     3.48   0.000     .0910808    .3253577
         Dpf |   .0121419   .0662411     0.18   0.855    -.1176882     .141972
     lowcomp |   .2942098   .0780016     3.77   0.000     .1413294    .4470902
     verored |  -.0207924   .0257529    -0.81   0.419    -.0712673    .0296824
       klima |   .1148759   .0312262     3.68   0.000     .0536736    .1760782
       _cons |  -2.839077   .3765329    -7.54   0.000    -3.577068   -2.101086
-------------+----------------------------------------------------------------
mills        |
      lambda |   .8234404   3.183163     0.26   0.796    -5.415445    7.062326
-------------+----------------------------------------------------------------
         rho |    0.12203
       sigma |  6.7479871
      lambda |  .82344045   3.183163
------------------------------------------------------------------------------

. scalar def reg7=_b[unexp_afar]

. scalar def reg8=_b[exp_afar]

. 
.                 
. /*NEW*/
. /*FOUR: af, ar, selection*/
. heckman delta_cn unexp_af unexp_ar exp_af exp_ar eta yrsedu* sex ncomp nperc np2 married employed pubblico self A52
> -A55 small Dpf, ///
> select(respondent= eta yrsedu* sex ncomp nperc np2 married employed pubblico self A52-A55 small Dpf ///
> lowcomp verored klima) two

Heckman selection model -- two-step estimates   Number of obs      =      4217
(regression model with sample selection)        Censored obs       =      3807
                                                Uncensored obs     =       410

                                                Wald chi2(20)      =     49.20
                                                Prob > chi2        =    0.0003

------------------------------------------------------------------------------
             |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
delta_cn     |
    unexp_af |  -.0738553   .2727336    -0.27   0.787    -.6084034    .4606928
    unexp_ar |   .0300869   .0110744     2.72   0.007     .0083814    .0517924
      exp_af |  -.0340722   .2621028    -0.13   0.897    -.5477843      .47964
      exp_ar |   .0339289   .0113193     3.00   0.003     .0117435    .0561142
         eta |   -.019328   .0405933    -0.48   0.634    -.0988893    .0602333
      yrsedu |   14.15137   15.60814     0.91   0.365    -16.44003    44.74276
         sex |    .788632   .9977952     0.79   0.429    -1.167011    2.744275
       ncomp |   .0801708   .4558201     0.18   0.860    -.8132201    .9735618
       nperc |   4.813376   2.273746     2.12   0.034     .3569168    9.269836
         np2 |  -1.429126   .5020061    -2.85   0.004     -2.41304   -.4452121
     married |  -.3426861   1.018419    -0.34   0.737     -2.33875    1.653378
    employed |   .4867132   1.173403     0.41   0.678    -1.813114     2.78654
    pubblico |  -.6121381   1.143446    -0.54   0.592    -2.853252    1.628976
     selfemp |   .8855853   1.291273     0.69   0.493    -1.645263    3.416433
         A52 |   1.857352   2.235333     0.83   0.406    -2.523819    6.238524
         A53 |   1.457852   1.818615     0.80   0.423    -2.106568    5.022272
         A54 |  -1.414666   2.702568    -0.52   0.601    -6.711601    3.882269
         A55 |   1.669383   4.783903     0.35   0.727    -7.706894    11.04566
       small |   .0592807   .8788832     0.07   0.946    -1.663299     1.78186
         Dpf |  -1.845895   .7665654    -2.41   0.016    -3.348335   -.3434542
       _cons |  -4.580021   7.819127    -0.59   0.558    -19.90523    10.74519
-------------+----------------------------------------------------------------
respondent   |
         eta |  -.0037757   .0032617    -1.16   0.247    -.0101685     .002617
      yrsedu |   5.453673   .7778335     7.01   0.000     3.929147    6.978199
         sex |   .2304977   .0706097     3.26   0.001     .0921052    .3688901
       ncomp |   .0447366   .0358559     1.25   0.212    -.0255397    .1150128
       nperc |    .487407   .1670576     2.92   0.004     .1599802    .8148339
         np2 |  -.0962323   .0382612    -2.52   0.012    -.1712228   -.0212418
     married |  -.0255422   .0884887    -0.29   0.773    -.1989768    .1478925
    employed |  -.1365863    .095406    -1.43   0.152    -.3235786     .050406
    pubblico |   .1034926   .0981588     1.05   0.292    -.0888952    .2958803
     selfemp |   -.072878   .1097722    -0.66   0.507    -.2880276    .1422715
         A52 |  -.7650477   .0805088    -9.50   0.000     -.922842   -.6072534
         A53 |  -.5563093   .0795953    -6.99   0.000    -.7123132   -.4003054
         A54 |  -.9300174   .0910521   -10.21   0.000    -1.108476   -.7515584
         A55 |  -1.443284   .1616098    -8.93   0.000    -1.760033   -1.126534
       small |   .2082193   .0597656     3.48   0.000     .0910808    .3253577
         Dpf |   .0121419   .0662411     0.18   0.855    -.1176882     .141972
     lowcomp |   .2942098   .0780016     3.77   0.000     .1413294    .4470902
     verored |  -.0207924   .0257529    -0.81   0.419    -.0712673    .0296824
       klima |   .1148759   .0312262     3.68   0.000     .0536736    .1760782
       _cons |  -2.839077   .3765329    -7.54   0.000    -3.577068   -2.101086
-------------+----------------------------------------------------------------
mills        |
      lambda |   .9978682   3.199108     0.31   0.755    -5.272269    7.268005
-------------+----------------------------------------------------------------
         rho |    0.14757
       sigma |  6.7619031
      lambda |  .99786818   3.199108
------------------------------------------------------------------------------

. scalar def reg9 =_b[unexp_af]

. scalar def reg10=_b[unexp_ar]

. scalar def reg11=_b[exp_af]

. scalar def reg12=_b[exp_ar]

. 
. 
. 
. /*REGRESSIONS WITH PREDICTIONS*/
. /*Sample of respondents*/
. /*FIVE: af+ar*/
. reg delta_cn unexp_afarhk exp_afarhk eta yrsedu* sex ncomp nperc np2 married employed pubblico self A52-A55 small D
> pf /*
> */ if afar>0 & mu_R!=. & mu_rf!=. & afar<2000, r

Linear regression                                      Number of obs =     410
                                                       F( 18,   391) =    1.66
                                                       Prob > F      =  0.0443
                                                       R-squared     =  0.1070
                                                       Root MSE      =  6.8719

------------------------------------------------------------------------------
             |               Robust
    delta_cn |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
unexp_afarhk |   .0312505   .0165354     1.89   0.060     -.001259    .0637599
  exp_afarhk |   .0340245   .0165678     2.05   0.041     .0014515    .0665976
         eta |  -.0181948    .043514    -0.42   0.676    -.1037455    .0673558
      yrsedu |    10.0959   10.97643     0.92   0.358     -11.4843     31.6761
         sex |   .6358262   .6862352     0.93   0.355    -.7133463    1.984999
       ncomp |   .0255395   .4849404     0.05   0.958    -.9278775    .9789564
       nperc |   4.443204   2.677451     1.66   0.098    -.8207981    9.707207
         np2 |  -1.355007   .6924078    -1.96   0.051    -2.716315    .0063011
     married |  -.3317219   1.010225    -0.33   0.743    -2.317875    1.654432
    employed |   .5642608   1.230629     0.46   0.647    -1.855217    2.983738
    pubblico |   -.678065   1.205034    -0.56   0.574    -3.047222    1.691092
     selfemp |   .7718629   1.548882     0.50   0.619    -2.273315    3.817041
         A52 |   2.410312   1.027139     2.35   0.019      .390905    4.429719
         A53 |    1.91904   1.225895     1.57   0.118    -.4911298     4.32921
         A54 |  -.5791252   1.236486    -0.47   0.640    -3.010119    1.851868
         A55 |   3.025066   2.020211     1.50   0.135     -.946769    6.996902
       small |  -.1068206   .7448003    -0.14   0.886    -1.571135    1.357494
         Dpf |  -1.738075   .8010172    -2.17   0.031    -3.312915   -.1632354
       _cons |  -2.276399    4.38014    -0.52   0.604    -10.88797    6.335173
------------------------------------------------------------------------------

. scalar def reg13=_b[unexp_afarhk]

. scalar def reg14=_b[exp_afarhk] 

.                         
.                         
. /*SIX: af, ar*/
. reg delta_cn unexp_afhk unexp_arhk exp_afhk exp_arhk eta yrsedu* sex ncomp nperc np2 married employed pubblico self
>  A52-A55 small Dpf /*
> */ if afar>0 & mu_R!=. & mu_rf!=. & afar<2000, r

Linear regression                                      Number of obs =     410
                                                       F( 20,   389) =    1.51
                                                       Prob > F      =  0.0743
                                                       R-squared     =  0.1075
                                                       Root MSE      =  6.8874

------------------------------------------------------------------------------
             |               Robust
    delta_cn |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
  unexp_afhk |  -.0546555   .2731768    -0.20   0.842    -.5917432    .4824322
  unexp_arhk |   .0310886   .0169237     1.84   0.067    -.0021848     .064362
    exp_afhk |   .0026422   .2308086     0.01   0.991    -.4511462    .4564305
    exp_arhk |   .0342496   .0169275     2.02   0.044     .0009688    .0675305
         eta |  -.0162205    .043532    -0.37   0.710    -.1018079    .0693669
      yrsedu |   10.86529   11.10734     0.98   0.329    -10.97264    32.70321
         sex |   .6499621    .690149     0.94   0.347    -.7069269    2.006851
       ncomp |   .0180473   .4848148     0.04   0.970     -.935138    .9712326
       nperc |   4.395808   2.685943     1.64   0.103    -.8849747     9.67659
         np2 |  -1.338986   .6935491    -1.93   0.054     -2.70256    .0245873
     married |   -.325098   1.013755    -0.32   0.749    -2.318222    1.668026
    employed |   .5710616   1.231551     0.46   0.643    -1.850268    2.992391
    pubblico |  -.6764438   1.205279    -0.56   0.575    -3.046119    1.693232
     selfemp |   .7911662   1.556059     0.51   0.611    -2.268171    3.850504
         A52 |    2.46355   1.052237     2.34   0.020     .3947664    4.532334
         A53 |     1.9448   1.249544     1.56   0.120    -.5119047    4.401504
         A54 |  -.6527964   1.245446    -0.52   0.600    -3.101445    1.795852
         A55 |   2.947688   2.030678     1.45   0.147    -1.044789    6.940165
       small |  -.1268447   .7454908    -0.17   0.865     -1.59254    1.338851
         Dpf |  -1.786068   .8086352    -2.21   0.028     -3.37591   -.1962255
       _cons |   -2.34663   4.392459    -0.53   0.593    -10.98256    6.289302
------------------------------------------------------------------------------

. scalar def reg15=_b[unexp_afhk]

. scalar def reg16=_b[unexp_arhk]

. scalar def reg17=_b[exp_afhk]

. scalar def reg18=_b[exp_arhk]

. 
.                                                         
. /*Whole sample*/
. /*SEVEN: af+ar*/
. reg delta_cn unexp_afarhk exp_afarhk eta yrsedu* sex ncomp nperc np2 married employed pubblico self A52-A55 small D
> pf /*
> */ if afar>0 & ar<1000 & af3<100, r

Linear regression                                      Number of obs =    3180
                                                       F( 18,  3161) =    1.62
                                                       Prob > F      =  0.0462
                                                       R-squared     =  0.0104
                                                       Root MSE      =  6.2266

------------------------------------------------------------------------------
             |               Robust
    delta_cn |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
unexp_afarhk |   .0124661   .0069054     1.81   0.071    -.0010733    .0260056
  exp_afarhk |   .0115064   .0066102     1.74   0.082    -.0014544    .0244671
         eta |   .0007738   .0120495     0.06   0.949    -.0228519    .0243995
      yrsedu |  -.6524133   3.515287    -0.19   0.853    -7.544889    6.240062
         sex |   .3473742   .2520262     1.38   0.168    -.1467772    .8415256
       ncomp |    .213071   .1449179     1.47   0.142    -.0710716    .4972136
       nperc |   1.067189   .6549696     1.63   0.103    -.2170195    2.351398
         np2 |  -.3324718    .163079    -2.04   0.042    -.6522232   -.0127204
     married |  -.0583378   .3297758    -0.18   0.860     -.704934    .5882584
    employed |  -.4162105   .3665699    -1.14   0.256    -1.134949    .3025285
    pubblico |   .9722377    .446472     2.18   0.030     .0968335    1.847642
     selfemp |    .025479   .5833348     0.04   0.965    -1.118274    1.169232
         A52 |   .5534313   .3368403     1.64   0.100    -.1070166    1.213879
         A53 |   .2201243    .376687     0.58   0.559    -.5184514       .9587
         A54 |  -.4718769    .309518    -1.52   0.127    -1.078753    .1349996
         A55 |   .2700034   .3303943     0.82   0.414    -.3778057    .9178125
       small |  -.0484848   .2255991    -0.21   0.830    -.4908204    .3938508
         Dpf |   .2447791   .2807808     0.87   0.383    -.3057519    .7953101
       _cons |  -.4820499   1.128316    -0.43   0.669    -2.694356    1.730256
------------------------------------------------------------------------------

. scalar def reg19=_b[unexp_afarhk]

. scalar def reg20=_b[exp_afarhk] 

.                         
.                         
. /*EIGHT: af, ar*/
. reg delta_cn unexp_afhk unexp_arhk exp_afhk exp_arhk eta yrsedu* sex ncomp nperc np2 married employed pubblico self
>  A52-A55 small Dpf /*
> */ if afar>0 & ar<1000 & af3<100, r

Linear regression                                      Number of obs =    3180
                                                       F( 20,  3159) =    1.50
                                                       Prob > F      =  0.0718
                                                       R-squared     =  0.0106
                                                       Root MSE      =  6.2279

------------------------------------------------------------------------------
             |               Robust
    delta_cn |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
  unexp_afhk |   .0929425   .1351563     0.69   0.492    -.1720605    .3579454
  unexp_arhk |   .0125545   .0069091     1.82   0.069    -.0009923    .0261013
    exp_afhk |   .0415242   .1194328     0.35   0.728    -.1926495    .2756979
    exp_arhk |   .0113306   .0066408     1.71   0.088      -.00169    .0243513
         eta |  -1.75e-06   .0120954    -0.00   1.000    -.0237173    .0237138
      yrsedu |  -1.131199    3.56002    -0.32   0.751    -8.111386    5.848987
         sex |   .3413308    .252066     1.35   0.176    -.1528989    .8355605
       ncomp |    .216592   .1448698     1.50   0.135    -.0674564    .5006405
       nperc |   1.067181   .6557337     1.63   0.104    -.2185262    2.352888
         np2 |  -.3337978   .1632249    -2.05   0.041    -.6538353   -.0137603
     married |   -.060757    .329884    -0.18   0.854    -.7075656    .5860517
    employed |  -.4115675   .3666738    -1.12   0.262     -1.13051    .3073755
    pubblico |   .9677229   .4472555     2.16   0.031     .0907822    1.844664
     selfemp |    .018489   .5844605     0.03   0.975    -1.127472     1.16445
         A52 |   .5461191   .3374291     1.62   0.106    -.1154834    1.207722
         A53 |   .2168723   .3787489     0.57   0.567    -.5257464    .9594911
         A54 |  -.4342456   .3128128    -1.39   0.165    -1.047583    .1790912
         A55 |   .3047644   .3330581     0.92   0.360    -.3482676    .9577964
       small |  -.0480548   .2256871    -0.21   0.831     -.490563    .3944534
         Dpf |   .2553479   .2805008     0.91   0.363    -.2946343    .8053301
       _cons |  -.4407524   1.130422    -0.39   0.697    -2.657187    1.775682
------------------------------------------------------------------------------

. scalar def reg21=_b[unexp_afhk]

. scalar def reg22=_b[unexp_arhk]

. scalar def reg23=_b[exp_afhk]

. scalar def reg24=_b[exp_arhk]

. 
. #delimit;       
delimiter now ;
. matrix define true=     reg1\reg2\reg3\reg4\reg5\reg6\reg7\reg8\reg9\reg10\reg11\reg12\
> /*K x 1 matrix*/                reg13\reg14\reg15\reg16\reg17\reg18\reg19\reg20\reg21\reg22\reg23\reg24;

.                 #delimit cr
delimiter now cr
. svmat true

. keep true

. keep if true!=.
(8410 observations deleted)

. gen repl=0      

. gen p=1

. sort repl

. qui by repl:replace p=sum(p)

. ren true coeff

. reshape wide coeff,i(repl) j(p)
(note: j = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24)

Data                               long   ->   wide
-----------------------------------------------------------------------------
Number of obs.                       24   ->       1
Number of variables                   3   ->      25
j variable (24 values)                p   ->   (dropped)
xij variables:
                                  coeff   ->   coeff1 coeff2 ... coeff24
-----------------------------------------------------------------------------

. compress
repl was float now byte

. save true,replace               /*TRUE COEFFICIENT ESTIMATES*/
(note: file true.dta not found)
file true.dta saved

. */
. 
. u rep,clear

. append using true

. erase true.dta

. 
. cap program drop doit

. program def doit
  1.           local i=1
  2.         while `i' < 25 {
  3.                 su coeff`i' if repl==0          /*True estimate*/
  4.                 scalar def true`i'=r(mean)
  5.                 su coeff`i' if repl!=0
  6.                 scalar def sd`i'=r(sd)
  7.                 scalar def t`i'=(true`i'/sd`i')
  8.                 gen tb`i'=(coeff`i'-true`i')/sd`i'
  9.                 count if tb`i'>=t`i'            /*Mi sembra che sia sempre 0!!!*/
 10.                 scalar def p`i'_up=(r(N)/(_N))
 11.                 count if tb`i'<=t`i'
 12.                 scalar def p`i'_lo=(r(N)/(_N))
 13.                 if p`i'_lo<p`i'_up      {
 14.                                 scalar def pvalue`i'=2*p`i'_lo
 15.                                                 }
 16.                 if p`i'_lo>p`i'_up      {
 17.                                 scalar def pvalue`i'=2*p`i'_up
 18.                                                 }
 19.                 scalar drop true`i' sd`i' t`i' p`i'_lo p`i'_up 
 20.                 drop tb`i'
 21.         local i=`i'+1
 22.                 }
 23. end

. qui doit

. 
. #delimit;
delimiter now ;
. scalar drop     reg1 reg2 reg3 reg4 reg5 reg6 reg7 reg8 reg9 reg10 reg11 reg12 
>                         reg13 reg14 reg15 reg16 reg17 reg18 reg19 reg20 reg21 reg22 reg23 reg24;

.         #delimit cr
delimiter now cr
. scalar list 
  pvalue24 =  .01598402
  pvalue23 =  .37762238
  pvalue22 =    .003996
  pvalue21 =  .35564436
  pvalue20 =  .01398601
  pvalue19 =    .003996
  pvalue18 =  .00999001
  pvalue17 =  .85314685
  pvalue16 =  .01598402
  pvalue15 =   .6013986
  pvalue14 =  .00599401
  pvalue13 =  .01198801
  pvalue12 =  .01198801
  pvalue11 =   .7012987
  pvalue10 =  .02197802
   pvalue9 =  .50749251
   pvalue8 =  .00599401
   pvalue7 =  .01598402
   pvalue6 =  .00999001
   pvalue5 =  .73526474
   pvalue4 =  .01998002
   pvalue3 =  .54345654
   pvalue2 =  .00599401
   pvalue1 =  .01198801

. save,replace
file rep.dta saved

. 
. log close
      name:  <unnamed>
       log:  c:\data\Expect\WE\tableres4.log
  log type:  text
 closed on:  25 Apr 2016, 13:59:23
---------------------------------------------------------------------------------------------------------------------
